/*
 * Copyright (c) 2008-2010,2012 Apple Inc. All Rights Reserved.
 */

#include <AssertMacros.h>
#include <CoreFoundation/CoreFoundation.h>
#include <Security/SecCertificate.h>
#include <Security/SecCertificatePriv.h>
#include <Security/SecPolicy.h>
#include <Security/SecTrust.h>
#include <utilities/SecCFRelease.h>
#include <stdlib.h>
#include <unistd.h>

#include "shared_regressions.h"

/*
    Apple Inc. CA
*/
static const uint8_t _c0[] = {
    0x30, 0x82, 0x04, 0xbb, 0x30, 0x82, 0x03, 0xa3,
    0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02,
    0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
    0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30,
    0x62, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
    0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13,
    0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13,
    0x0a, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x49,
    0x6e, 0x63, 0x2e, 0x31, 0x26, 0x30, 0x24, 0x06,
    0x03, 0x55, 0x04, 0x0b, 0x13, 0x1d, 0x41, 0x70,
    0x70, 0x6c, 0x65, 0x20, 0x43, 0x65, 0x72, 0x74,
    0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
    0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72,
    0x69, 0x74, 0x79, 0x31, 0x16, 0x30, 0x14, 0x06,
    0x03, 0x55, 0x04, 0x03, 0x13, 0x0d, 0x41, 0x70,
    0x70, 0x6c, 0x65, 0x20, 0x52, 0x6f, 0x6f, 0x74,
    0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x30,
    0x36, 0x30, 0x34, 0x32, 0x35, 0x32, 0x31, 0x34,
    0x30, 0x33, 0x36, 0x5a, 0x17, 0x0d, 0x33, 0x35,
    0x30, 0x32, 0x30, 0x39, 0x32, 0x31, 0x34, 0x30,
    0x33, 0x36, 0x5a, 0x30, 0x62, 0x31, 0x0b, 0x30,
    0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
    0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
    0x55, 0x04, 0x0a, 0x13, 0x0a, 0x41, 0x70, 0x70,
    0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31,
    0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04, 0x0b,
    0x13, 0x1d, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20,
    0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63,
    0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x41, 0x75,
    0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31,
    0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x03,
    0x13, 0x0d, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20,
    0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41, 0x30,
    0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a,
    0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01,
    0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30,
    0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00,
    0xe4, 0x91, 0xa9, 0x09, 0x1f, 0x91, 0xdb, 0x1e,
    0x47, 0x50, 0xeb, 0x05, 0xed, 0x5e, 0x79, 0x84,
    0x2d, 0xeb, 0x36, 0xa2, 0x57, 0x4c, 0x55, 0xec,
    0x8b, 0x19, 0x89, 0xde, 0xf9, 0x4b, 0x6c, 0xf5,
    0x07, 0xab, 0x22, 0x30, 0x02, 0xe8, 0x18, 0x3e,
    0xf8, 0x50, 0x09, 0xd3, 0x7f, 0x41, 0xa8, 0x98,
    0xf9, 0xd1, 0xca, 0x66, 0x9c, 0x24, 0x6b, 0x11,
    0xd0, 0xa3, 0xbb, 0xe4, 0x1b, 0x2a, 0xc3, 0x1f,
    0x95, 0x9e, 0x7a, 0x0c, 0xa4, 0x47, 0x8b, 0x5b,
    0xd4, 0x16, 0x37, 0x33, 0xcb, 0xc4, 0x0f, 0x4d,
    0xce, 0x14, 0x69, 0xd1, 0xc9, 0x19, 0x72, 0xf5,
    0x5d, 0x0e, 0xd5, 0x7f, 0x5f, 0x9b, 0xf2, 0x25,
    0x03, 0xba, 0x55, 0x8f, 0x4d, 0x5d, 0x0d, 0xf1,
    0x64, 0x35, 0x23, 0x15, 0x4b, 0x15, 0x59, 0x1d,
    0xb3, 0x94, 0xf7, 0xf6, 0x9c, 0x9e, 0xcf, 0x50,
    0xba, 0xc1, 0x58, 0x50, 0x67, 0x8f, 0x08, 0xb4,
    0x20, 0xf7, 0xcb, 0xac, 0x2c, 0x20, 0x6f, 0x70,
    0xb6, 0x3f, 0x01, 0x30, 0x8c, 0xb7, 0x43, 0xcf,
    0x0f, 0x9d, 0x3d, 0xf3, 0x2b, 0x49, 0x28, 0x1a,
    0xc8, 0xfe, 0xce, 0xb5, 0xb9, 0x0e, 0xd9, 0x5e,
    0x1c, 0xd6, 0xcb, 0x3d, 0xb5, 0x3a, 0xad, 0xf4,
    0x0f, 0x0e, 0x00, 0x92, 0x0b, 0xb1, 0x21, 0x16,
    0x2e, 0x74, 0xd5, 0x3c, 0x0d, 0xdb, 0x62, 0x16,
    0xab, 0xa3, 0x71, 0x92, 0x47, 0x53, 0x55, 0xc1,
    0xaf, 0x2f, 0x41, 0xb3, 0xf8, 0xfb, 0xe3, 0x70,
    0xcd, 0xe6, 0xa3, 0x4c, 0x45, 0x7e, 0x1f, 0x4c,
    0x6b, 0x50, 0x96, 0x41, 0x89, 0xc4, 0x74, 0x62,
    0x0b, 0x10, 0x83, 0x41, 0x87, 0x33, 0x8a, 0x81,
    0xb1, 0x30, 0x58, 0xec, 0x5a, 0x04, 0x32, 0x8c,
    0x68, 0xb3, 0x8f, 0x1d, 0xde, 0x65, 0x73, 0xff,
    0x67, 0x5e, 0x65, 0xbc, 0x49, 0xd8, 0x76, 0x9f,
    0x33, 0x14, 0x65, 0xa1, 0x77, 0x94, 0xc9, 0x2d,
    0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x82, 0x01,
    0x7a, 0x30, 0x82, 0x01, 0x76, 0x30, 0x0e, 0x06,
    0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04,
    0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x0f, 0x06,
    0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04,
    0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1d,
    0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04,
    0x14, 0x2b, 0xd0, 0x69, 0x47, 0x94, 0x76, 0x09,
    0xfe, 0xf4, 0x6b, 0x8d, 0x2e, 0x40, 0xa6, 0xf7,
    0x47, 0x4d, 0x7f, 0x08, 0x5e, 0x30, 0x1f, 0x06,
    0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16,
    0x80, 0x14, 0x2b, 0xd0, 0x69, 0x47, 0x94, 0x76,
    0x09, 0xfe, 0xf4, 0x6b, 0x8d, 0x2e, 0x40, 0xa6,
    0xf7, 0x47, 0x4d, 0x7f, 0x08, 0x5e, 0x30, 0x82,
    0x01, 0x11, 0x06, 0x03, 0x55, 0x1d, 0x20, 0x04,
    0x82, 0x01, 0x08, 0x30, 0x82, 0x01, 0x04, 0x30,
    0x82, 0x01, 0x00, 0x06, 0x09, 0x2a, 0x86, 0x48,
    0x86, 0xf7, 0x63, 0x64, 0x05, 0x01, 0x30, 0x81,
    0xf2, 0x30, 0x2a, 0x06, 0x08, 0x2b, 0x06, 0x01,
    0x05, 0x05, 0x07, 0x02, 0x01, 0x16, 0x1e, 0x68,
    0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77,
    0x77, 0x77, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65,
    0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x70,
    0x6c, 0x65, 0x63, 0x61, 0x2f, 0x30, 0x81, 0xc3,
    0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
    0x02, 0x02, 0x30, 0x81, 0xb6, 0x1a, 0x81, 0xb3,
    0x52, 0x65, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65,
    0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73,
    0x20, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69,
    0x63, 0x61, 0x74, 0x65, 0x20, 0x62, 0x79, 0x20,
    0x61, 0x6e, 0x79, 0x20, 0x70, 0x61, 0x72, 0x74,
    0x79, 0x20, 0x61, 0x73, 0x73, 0x75, 0x6d, 0x65,
    0x73, 0x20, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74,
    0x61, 0x6e, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20,
    0x74, 0x68, 0x65, 0x20, 0x74, 0x68, 0x65, 0x6e,
    0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61,
    0x62, 0x6c, 0x65, 0x20, 0x73, 0x74, 0x61, 0x6e,
    0x64, 0x61, 0x72, 0x64, 0x20, 0x74, 0x65, 0x72,
    0x6d, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x63,
    0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
    0x73, 0x20, 0x6f, 0x66, 0x20, 0x75, 0x73, 0x65,
    0x2c, 0x20, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66,
    0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x70, 0x6f,
    0x6c, 0x69, 0x63, 0x79, 0x20, 0x61, 0x6e, 0x64,
    0x20, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69,
    0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x70,
    0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x20,
    0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e,
    0x74, 0x73, 0x2e, 0x30, 0x0d, 0x06, 0x09, 0x2a,
    0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05,
    0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x5c,
    0x36, 0x99, 0x4c, 0x2d, 0x78, 0xb7, 0xed, 0x8c,
    0x9b, 0xdc, 0xf3, 0x77, 0x9b, 0xf2, 0x76, 0xd2,
    0x77, 0x30, 0x4f, 0xc1, 0x1f, 0x85, 0x83, 0x85,
    0x1b, 0x99, 0x3d, 0x47, 0x37, 0xf2, 0xa9, 0x9b,
    0x40, 0x8e, 0x2c, 0xd4, 0xb1, 0x90, 0x12, 0xd8,
    0xbe, 0xf4, 0x73, 0x9b, 0xee, 0xd2, 0x64, 0x0f,
    0xcb, 0x79, 0x4f, 0x34, 0xd8, 0xa2, 0x3e, 0xf9,
    0x78, 0xff, 0x6b, 0xc8, 0x07, 0xec, 0x7d, 0x39,
    0x83, 0x8b, 0x53, 0x20, 0xd3, 0x38, 0xc4, 0xb1,
    0xbf, 0x9a, 0x4f, 0x0a, 0x6b, 0xff, 0x2b, 0xfc,
    0x59, 0xa7, 0x05, 0x09, 0x7c, 0x17, 0x40, 0x56,
    0x11, 0x1e, 0x74, 0xd3, 0xb7, 0x8b, 0x23, 0x3b,
    0x47, 0xa3, 0xd5, 0x6f, 0x24, 0xe2, 0xeb, 0xd1,
    0xb7, 0x70, 0xdf, 0x0f, 0x45, 0xe1, 0x27, 0xca,
    0xf1, 0x6d, 0x78, 0xed, 0xe7, 0xb5, 0x17, 0x17,
    0xa8, 0xdc, 0x7e, 0x22, 0x35, 0xca, 0x25, 0xd5,
    0xd9, 0x0f, 0xd6, 0x6b, 0xd4, 0xa2, 0x24, 0x23,
    0x11, 0xf7, 0xa1, 0xac, 0x8f, 0x73, 0x81, 0x60,
    0xc6, 0x1b, 0x5b, 0x09, 0x2f, 0x92, 0xb2, 0xf8,
    0x44, 0x48, 0xf0, 0x60, 0x38, 0x9e, 0x15, 0xf5,
    0x3d, 0x26, 0x67, 0x20, 0x8a, 0x33, 0x6a, 0xf7,
    0x0d, 0x82, 0xcf, 0xde, 0xeb, 0xa3, 0x2f, 0xf9,
    0x53, 0x6a, 0x5b, 0x64, 0xc0, 0x63, 0x33, 0x77,
    0xf7, 0x3a, 0x07, 0x2c, 0x56, 0xeb, 0xda, 0x0f,
    0x21, 0x0e, 0xda, 0xba, 0x73, 0x19, 0x4f, 0xb5,
    0xd9, 0x36, 0x7f, 0xc1, 0x87, 0x55, 0xd9, 0xa7,
    0x99, 0xb9, 0x32, 0x42, 0xfb, 0xd8, 0xd5, 0x71,
    0x9e, 0x7e, 0xa1, 0x52, 0xb7, 0x1b, 0xbd, 0x93,
    0x42, 0x24, 0x12, 0x2a, 0xc7, 0x0f, 0x1d, 0xb6,
    0x4d, 0x9c, 0x5e, 0x63, 0xc8, 0x4b, 0x80, 0x17,
    0x50, 0xaa, 0x8a, 0xd5, 0xda, 0xe4, 0xfc, 0xd0,
    0x09, 0x07, 0x37, 0xb0, 0x75, 0x75, 0x21,
};

/*
	subject= /O=VeriSign Trust Network/OU=VeriSign, Inc./OU=VeriSign International Server CA - Class 3/OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
	issuer= /C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority
	serial=254B8A853842CCE358F8C5DDAE226EA4
*/
static const uint8_t _c1[] = {
    0x30, 0x82, 0x03, 0x83, 0x30, 0x82, 0x02, 0xec,
    0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x25,
    0x4b, 0x8a, 0x85, 0x38, 0x42, 0xcc, 0xe3, 0x58,
    0xf8, 0xc5, 0xdd, 0xae, 0x22, 0x6e, 0xa4, 0x30,
    0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
    0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x5f,
    0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
    0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x17, 0x30,
    0x15, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0e,
    0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6e,
    0x2c, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31, 0x37,
    0x30, 0x35, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13,
    0x2e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x20, 0x33,
    0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
    0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x20,
    0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63,
    0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x41, 0x75,
    0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x30,
    0x1e, 0x17, 0x0d, 0x39, 0x37, 0x30, 0x34, 0x31,
    0x37, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a,
    0x17, 0x0d, 0x31, 0x31, 0x31, 0x30, 0x32, 0x34,
    0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30,
    0x81, 0xba, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03,
    0x55, 0x04, 0x0a, 0x13, 0x16, 0x56, 0x65, 0x72,
    0x69, 0x53, 0x69, 0x67, 0x6e, 0x20, 0x54, 0x72,
    0x75, 0x73, 0x74, 0x20, 0x4e, 0x65, 0x74, 0x77,
    0x6f, 0x72, 0x6b, 0x31, 0x17, 0x30, 0x15, 0x06,
    0x03, 0x55, 0x04, 0x0b, 0x13, 0x0e, 0x56, 0x65,
    0x72, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x2c, 0x20,
    0x49, 0x6e, 0x63, 0x2e, 0x31, 0x33, 0x30, 0x31,
    0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x2a, 0x56,
    0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x20,
    0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74,
    0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65,
    0x72, 0x76, 0x65, 0x72, 0x20, 0x43, 0x41, 0x20,
    0x2d, 0x20, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x20,
    0x33, 0x31, 0x49, 0x30, 0x47, 0x06, 0x03, 0x55,
    0x04, 0x0b, 0x13, 0x40, 0x77, 0x77, 0x77, 0x2e,
    0x76, 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e,
    0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x43, 0x50, 0x53,
    0x20, 0x49, 0x6e, 0x63, 0x6f, 0x72, 0x70, 0x2e,
    0x62, 0x79, 0x20, 0x52, 0x65, 0x66, 0x2e, 0x20,
    0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54,
    0x59, 0x20, 0x4c, 0x54, 0x44, 0x2e, 0x28, 0x63,
    0x29, 0x39, 0x37, 0x20, 0x56, 0x65, 0x72, 0x69,
    0x53, 0x69, 0x67, 0x6e, 0x30, 0x81, 0x9f, 0x30,
    0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
    0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,
    0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81,
    0x00, 0xd8, 0x82, 0x80, 0xe8, 0xd6, 0x19, 0x02,
    0x7d, 0x1f, 0x85, 0x18, 0x39, 0x25, 0xa2, 0x65,
    0x2b, 0xe1, 0xbf, 0xd4, 0x05, 0xd3, 0xbc, 0xe6,
    0x36, 0x3b, 0xaa, 0xf0, 0x4c, 0x6c, 0x5b, 0xb6,
    0xe7, 0xaa, 0x3c, 0x73, 0x45, 0x55, 0xb2, 0xf1,
    0xbd, 0xea, 0x97, 0x42, 0xed, 0x9a, 0x34, 0x0a,
    0x15, 0xd4, 0xa9, 0x5c, 0xf5, 0x40, 0x25, 0xdd,
    0xd9, 0x07, 0xc1, 0x32, 0xb2, 0x75, 0x6c, 0xc4,
    0xca, 0xbb, 0xa3, 0xfe, 0x56, 0x27, 0x71, 0x43,
    0xaa, 0x63, 0xf5, 0x30, 0x3e, 0x93, 0x28, 0xe5,
    0xfa, 0xf1, 0x09, 0x3b, 0xf3, 0xb7, 0x4d, 0x4e,
    0x39, 0xf7, 0x5c, 0x49, 0x5a, 0xb8, 0xc1, 0x1d,
    0xd3, 0xb2, 0x8a, 0xfe, 0x70, 0x30, 0x95, 0x42,
    0xcb, 0xfe, 0x2b, 0x51, 0x8b, 0x5a, 0x3c, 0x3a,
    0xf9, 0x22, 0x4f, 0x90, 0xb2, 0x02, 0xa7, 0x53,
    0x9c, 0x4f, 0x34, 0xe7, 0xab, 0x04, 0xb2, 0x7b,
    0x6f, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81,
    0xe3, 0x30, 0x81, 0xe0, 0x30, 0x0f, 0x06, 0x03,
    0x55, 0x1d, 0x13, 0x04, 0x08, 0x30, 0x06, 0x01,
    0x01, 0xff, 0x02, 0x01, 0x00, 0x30, 0x44, 0x06,
    0x03, 0x55, 0x1d, 0x20, 0x04, 0x3d, 0x30, 0x3b,
    0x30, 0x39, 0x06, 0x0b, 0x60, 0x86, 0x48, 0x01,
    0x86, 0xf8, 0x45, 0x01, 0x07, 0x01, 0x01, 0x30,
    0x2a, 0x30, 0x28, 0x06, 0x08, 0x2b, 0x06, 0x01,
    0x05, 0x05, 0x07, 0x02, 0x01, 0x16, 0x1c, 0x68,
    0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77,
    0x77, 0x77, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x73,
    0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
    0x43, 0x50, 0x53, 0x30, 0x34, 0x06, 0x03, 0x55,
    0x1d, 0x25, 0x04, 0x2d, 0x30, 0x2b, 0x06, 0x08,
    0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01,
    0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
    0x03, 0x02, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,
    0x86, 0xf8, 0x42, 0x04, 0x01, 0x06, 0x0a, 0x60,
    0x86, 0x48, 0x01, 0x86, 0xf8, 0x45, 0x01, 0x08,
    0x01, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f,
    0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x11,
    0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8,
    0x42, 0x01, 0x01, 0x04, 0x04, 0x03, 0x02, 0x01,
    0x06, 0x30, 0x31, 0x06, 0x03, 0x55, 0x1d, 0x1f,
    0x04, 0x2a, 0x30, 0x28, 0x30, 0x26, 0xa0, 0x24,
    0xa0, 0x22, 0x86, 0x20, 0x68, 0x74, 0x74, 0x70,
    0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x76,
    0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e, 0x2e,
    0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x63, 0x61, 0x33,
    0x2e, 0x63, 0x72, 0x6c, 0x30, 0x0d, 0x06, 0x09,
    0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
    0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x08,
    0x01, 0xec, 0xe4, 0x68, 0x94, 0x03, 0x42, 0xf1,
    0x73, 0xf1, 0x23, 0xa2, 0x3a, 0xde, 0xe9, 0xf1,
    0xda, 0xc6, 0x54, 0xc4, 0x23, 0x3e, 0x86, 0xea,
    0xcf, 0x6a, 0x3a, 0x33, 0xab, 0xea, 0x9c, 0x04,
    0x14, 0x07, 0x36, 0x06, 0x0b, 0xf9, 0x88, 0x6f,
    0xd5, 0x13, 0xee, 0x29, 0x2b, 0xc3, 0xe4, 0x72,
    0x8d, 0x44, 0xed, 0xd1, 0xac, 0x20, 0x09, 0x2d,
    0xe1, 0xf6, 0xe1, 0x19, 0x05, 0x38, 0xb0, 0x3d,
    0x0f, 0x9f, 0x7f, 0xf8, 0x9e, 0x02, 0xdc, 0x86,
    0x02, 0x86, 0x61, 0x4e, 0x26, 0x5f, 0x5e, 0x9f,
    0x92, 0x1e, 0x0c, 0x24, 0xa4, 0xf5, 0xd0, 0x70,
    0x13, 0xcf, 0x26, 0xc3, 0x43, 0x3d, 0x49, 0x1d,
    0x9e, 0x82, 0x2e, 0x52, 0x5f, 0xbc, 0x3e, 0xc6,
    0x66, 0x29, 0x01, 0x8e, 0x4e, 0x92, 0x2c, 0xbc,
    0x46, 0x75, 0x03, 0x82, 0xac, 0x73, 0xe9, 0xd9,
    0x7e, 0x0b, 0x67, 0xef, 0x54, 0x52, 0x1a
};


/*
   subject= /C=US/O=University of Virginia/OU=UVA Standard PKI User/emailAddress=kmm6b@Virginia.EDU/CN=Keith M. Moores 10
   issuer= /C=US/ST=Virginia/L=Charlottesville/O=University of Virginia/emailAddress=pkimaster@virginia.edu/CN=UVA Standard Assurance SKP 1
   serial=0C6D
*/
static const uint8_t _c2[] = {
    0x30, 0x82, 0x05, 0x56, 0x30, 0x82, 0x04, 0xbf,
    0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x02, 0x0c,
    0x6d, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48,
    0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00,
    0x30, 0x81, 0xa9, 0x31, 0x0b, 0x30, 0x09, 0x06,
    0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53,
    0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04,
    0x08, 0x13, 0x08, 0x56, 0x69, 0x72, 0x67, 0x69,
    0x6e, 0x69, 0x61, 0x31, 0x18, 0x30, 0x16, 0x06,
    0x03, 0x55, 0x04, 0x07, 0x13, 0x0f, 0x43, 0x68,
    0x61, 0x72, 0x6c, 0x6f, 0x74, 0x74, 0x65, 0x73,
    0x76, 0x69, 0x6c, 0x6c, 0x65, 0x31, 0x1f, 0x30,
    0x1d, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x16,
    0x55, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x69,
    0x74, 0x79, 0x20, 0x6f, 0x66, 0x20, 0x56, 0x69,
    0x72, 0x67, 0x69, 0x6e, 0x69, 0x61, 0x31, 0x25,
    0x30, 0x23, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
    0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x16, 0x70,
    0x6b, 0x69, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72,
    0x40, 0x76, 0x69, 0x72, 0x67, 0x69, 0x6e, 0x69,
    0x61, 0x2e, 0x65, 0x64, 0x75, 0x31, 0x25, 0x30,
    0x23, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1c,
    0x55, 0x56, 0x41, 0x20, 0x53, 0x74, 0x61, 0x6e,
    0x64, 0x61, 0x72, 0x64, 0x20, 0x41, 0x73, 0x73,
    0x75, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x20, 0x53,
    0x4b, 0x50, 0x20, 0x31, 0x30, 0x1e, 0x17, 0x0d,
    0x30, 0x34, 0x30, 0x31, 0x30, 0x38, 0x31, 0x37,
    0x32, 0x35, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x30,
    0x35, 0x30, 0x31, 0x30, 0x38, 0x31, 0x37, 0x32,
    0x35, 0x30, 0x30, 0x5a, 0x30, 0x81, 0x8e, 0x31,
    0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
    0x13, 0x02, 0x55, 0x53, 0x31, 0x1f, 0x30, 0x1d,
    0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x16, 0x55,
    0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x69, 0x74,
    0x79, 0x20, 0x6f, 0x66, 0x20, 0x56, 0x69, 0x72,
    0x67, 0x69, 0x6e, 0x69, 0x61, 0x31, 0x1e, 0x30,
    0x1c, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x15,
    0x55, 0x56, 0x41, 0x20, 0x53, 0x74, 0x61, 0x6e,
    0x64, 0x61, 0x72, 0x64, 0x20, 0x50, 0x4b, 0x49,
    0x20, 0x55, 0x73, 0x65, 0x72, 0x31, 0x21, 0x30,
    0x1f, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
    0x0d, 0x01, 0x09, 0x01, 0x16, 0x12, 0x6b, 0x6d,
    0x6d, 0x36, 0x62, 0x40, 0x56, 0x69, 0x72, 0x67,
    0x69, 0x6e, 0x69, 0x61, 0x2e, 0x45, 0x44, 0x55,
    0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04,
    0x03, 0x13, 0x12, 0x4b, 0x65, 0x69, 0x74, 0x68,
    0x20, 0x4d, 0x2e, 0x20, 0x4d, 0x6f, 0x6f, 0x72,
    0x65, 0x73, 0x20, 0x31, 0x30, 0x30, 0x81, 0x9f,
    0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
    0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03,
    0x81, 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81,
    0x81, 0x00, 0xb4, 0xf9, 0x1b, 0xda, 0x10, 0x01,
    0x47, 0x96, 0xb4, 0xea, 0xb2, 0x35, 0xbb, 0x7e,
    0x69, 0x69, 0xd9, 0x49, 0x2c, 0x36, 0x3a, 0x27,
    0x55, 0x6e, 0x11, 0xb1, 0xdf, 0x13, 0x54, 0xf2,
    0x66, 0xa5, 0x98, 0x3a, 0xfd, 0x7e, 0xda, 0x6d,
    0x12, 0xb7, 0x06, 0xaa, 0xde, 0x55, 0x50, 0x04,
    0xf5, 0x91, 0x27, 0xc7, 0x4d, 0x85, 0x91, 0xd9,
    0xc5, 0xd6, 0x88, 0xc6, 0x33, 0x40, 0x83, 0xc0,
    0xe4, 0x83, 0xe2, 0x9f, 0x49, 0xfb, 0xc1, 0x1f,
    0xdb, 0xd9, 0xf4, 0xd4, 0x32, 0x2e, 0x3a, 0xe9,
    0xb4, 0x12, 0x5d, 0x58, 0x2a, 0x65, 0x4e, 0xc7,
    0x09, 0x59, 0xfc, 0x2b, 0x0d, 0xda, 0x6a, 0xc3,
    0x9f, 0x32, 0x7d, 0xf2, 0xfc, 0xf4, 0x3e, 0xb8,
    0x63, 0xbc, 0x13, 0x74, 0xc6, 0x0e, 0x76, 0x3a,
    0x7a, 0xe9, 0x93, 0x97, 0x7f, 0xc8, 0x2b, 0x33,
    0x9f, 0xd8, 0x59, 0xef, 0xc0, 0x0a, 0x2e, 0xd3,
    0xd9, 0x69, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3,
    0x82, 0x02, 0xa4, 0x30, 0x82, 0x02, 0xa0, 0x30,
    0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04,
    0x03, 0x02, 0x05, 0xa0, 0x30, 0x1d, 0x06, 0x03,
    0x55, 0x1d, 0x25, 0x04, 0x16, 0x30, 0x14, 0x06,
    0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03,
    0x02, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05,
    0x07, 0x03, 0x04, 0x30, 0x1d, 0x06, 0x03, 0x55,
    0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x4d, 0xe0,
    0xe1, 0x57, 0xb6, 0x91, 0x7a, 0x34, 0x99, 0x7a,
    0xe5, 0x2a, 0xd6, 0xae, 0x0a, 0x75, 0x05, 0x73,
    0x5d, 0x30, 0x30, 0x09, 0x06, 0x03, 0x55, 0x1d,
    0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1f, 0x06,
    0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16,
    0x80, 0x14, 0x2c, 0xb7, 0xe3, 0xa6, 0x09, 0x68,
    0x85, 0x90, 0x58, 0x8e, 0x2d, 0xd5, 0x3a, 0xef,
    0x93, 0x02, 0x2a, 0x4c, 0x85, 0x62, 0x30, 0x41,
    0x06, 0x03, 0x55, 0x1d, 0x11, 0x04, 0x3a, 0x30,
    0x38, 0xa0, 0x22, 0x06, 0x0a, 0x2b, 0x06, 0x01,
    0x04, 0x01, 0x82, 0x37, 0x14, 0x02, 0x03, 0xa0,
    0x14, 0x0c, 0x12, 0x6b, 0x6d, 0x6d, 0x36, 0x62,
    0x40, 0x56, 0x69, 0x72, 0x67, 0x69, 0x6e, 0x69,
    0x61, 0x2e, 0x45, 0x44, 0x55, 0x81, 0x12, 0x6b,
    0x6d, 0x6d, 0x36, 0x62, 0x40, 0x56, 0x69, 0x72,
    0x67, 0x69, 0x6e, 0x69, 0x61, 0x2e, 0x45, 0x44,
    0x55, 0x30, 0x2f, 0x06, 0x03, 0x55, 0x1d, 0x12,
    0x04, 0x28, 0x30, 0x26, 0x81, 0x16, 0x70, 0x6b,
    0x69, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x40,
    0x56, 0x69, 0x72, 0x67, 0x69, 0x6e, 0x69, 0x61,
    0x2e, 0x45, 0x44, 0x55, 0x82, 0x0c, 0x56, 0x69,
    0x72, 0x67, 0x69, 0x6e, 0x69, 0x61, 0x2e, 0x45,
    0x44, 0x55, 0x30, 0x82, 0x01, 0x5c, 0x06, 0x03,
    0x55, 0x1d, 0x1f, 0x04, 0x82, 0x01, 0x53, 0x30,
    0x82, 0x01, 0x4f, 0x30, 0x74, 0xa0, 0x72, 0xa0,
    0x70, 0x86, 0x6e, 0x6c, 0x64, 0x61, 0x70, 0x3a,
    0x2f, 0x2f, 0x6c, 0x64, 0x61, 0x70, 0x2e, 0x70,
    0x6b, 0x69, 0x2e, 0x76, 0x69, 0x72, 0x67, 0x69,
    0x6e, 0x69, 0x61, 0x2e, 0x65, 0x64, 0x75, 0x2f,
    0x63, 0x3d, 0x55, 0x53, 0x2c, 0x6f, 0x3d, 0x55,
    0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x69, 0x74,
    0x79, 0x25, 0x32, 0x30, 0x6f, 0x66, 0x25, 0x32,
    0x30, 0x56, 0x69, 0x72, 0x67, 0x69, 0x6e, 0x69,
    0x61, 0x2c, 0x6f, 0x75, 0x3d, 0x55, 0x56, 0x41,
    0x25, 0x32, 0x30, 0x53, 0x74, 0x61, 0x6e, 0x64,
    0x61, 0x72, 0x64, 0x25, 0x32, 0x30, 0x41, 0x73,
    0x73, 0x75, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x25,
    0x32, 0x30, 0x53, 0x4b, 0x50, 0x25, 0x32, 0x30,
    0x31, 0x2c, 0x63, 0x6e, 0x3d, 0x30, 0x43, 0x36,
    0x44, 0x30, 0x74, 0xa0, 0x72, 0xa0, 0x70, 0x86,
    0x6e, 0x6c, 0x64, 0x61, 0x70, 0x3a, 0x2f, 0x2f,
    0x6c, 0x64, 0x61, 0x70, 0x2e, 0x70, 0x6b, 0x69,
    0x2e, 0x76, 0x69, 0x72, 0x67, 0x69, 0x6e, 0x69,
    0x61, 0x2e, 0x65, 0x64, 0x75, 0x2f, 0x63, 0x6e,
    0x3d, 0x30, 0x43, 0x36, 0x44, 0x2c, 0x6f, 0x75,
    0x3d, 0x55, 0x56, 0x41, 0x25, 0x32, 0x30, 0x53,
    0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x25,
    0x32, 0x30, 0x41, 0x73, 0x73, 0x75, 0x72, 0x61,
    0x6e, 0x63, 0x65, 0x25, 0x32, 0x30, 0x53, 0x4b,
    0x50, 0x25, 0x32, 0x30, 0x31, 0x2c, 0x6f, 0x3d,
    0x55, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x69,
    0x74, 0x79, 0x25, 0x32, 0x30, 0x6f, 0x66, 0x25,
    0x32, 0x30, 0x56, 0x69, 0x72, 0x67, 0x69, 0x6e,
    0x69, 0x61, 0x2c, 0x63, 0x3d, 0x55, 0x53, 0x30,
    0x61, 0xa0, 0x5f, 0xa0, 0x5d, 0x86, 0x5b, 0x68,
    0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77,
    0x77, 0x2e, 0x70, 0x6b, 0x69, 0x2e, 0x76, 0x69,
    0x72, 0x67, 0x69, 0x6e, 0x69, 0x61, 0x2e, 0x65,
    0x64, 0x75, 0x2f, 0x63, 0x67, 0x69, 0x2d, 0x62,
    0x69, 0x6e, 0x2f, 0x67, 0x65, 0x74, 0x2d, 0x63,
    0x72, 0x6c, 0x3f, 0x6f, 0x75, 0x3d, 0x55, 0x56,
    0x41, 0x25, 0x32, 0x30, 0x53, 0x74, 0x61, 0x6e,
    0x64, 0x61, 0x72, 0x64, 0x25, 0x32, 0x30, 0x41,
    0x73, 0x73, 0x75, 0x72, 0x61, 0x6e, 0x63, 0x65,
    0x25, 0x32, 0x30, 0x53, 0x4b, 0x50, 0x25, 0x32,
    0x30, 0x31, 0x26, 0x63, 0x6e, 0x3d, 0x30, 0x43,
    0x36, 0x44, 0x30, 0x53, 0x06, 0x03, 0x55, 0x1d,
    0x20, 0x04, 0x4c, 0x30, 0x4a, 0x30, 0x48, 0x06,
    0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xb4, 0x76,
    0x01, 0x01, 0x30, 0x3b, 0x30, 0x39, 0x06, 0x08,
    0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x02, 0x01,
    0x16, 0x2d, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
    0x2f, 0x77, 0x77, 0x77, 0x2e, 0x70, 0x6b, 0x69,
    0x2e, 0x76, 0x69, 0x72, 0x67, 0x69, 0x6e, 0x69,
    0x61, 0x2e, 0x65, 0x64, 0x75, 0x2f, 0x73, 0x74,
    0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x2f, 0x63,
    0x70, 0x73, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x30,
    0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
    0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x81,
    0x81, 0x00, 0x9f, 0xf2, 0x7f, 0x51, 0x97, 0x2c,
    0xe6, 0x8f, 0x50, 0xba, 0x75, 0xd8, 0x9c, 0x77,
    0x5e, 0x2a, 0xe9, 0xbe, 0x18, 0x37, 0x7f, 0x18,
    0x86, 0xbb, 0x9d, 0x22, 0xf2, 0xf9, 0x3e, 0x22,
    0x00, 0x0b, 0xf2, 0x41, 0x6b, 0x08, 0x17, 0xbc,
    0x7a, 0xc4, 0xc9, 0x99, 0xa0, 0xbd, 0x53, 0x8d,
    0x52, 0xdb, 0xcc, 0xd0, 0x88, 0x14, 0x2a, 0x05,
    0x93, 0xcd, 0xf3, 0xa0, 0xf3, 0xb9, 0xdb, 0x35,
    0x5c, 0xec, 0x24, 0xe8, 0x08, 0xbe, 0x4e, 0xa1,
    0xa2, 0x54, 0x41, 0xbc, 0xbe, 0x7b, 0x22, 0xf4,
    0x03, 0x7d, 0xd0, 0xfb, 0x25, 0x8d, 0xf5, 0xa9,
    0x04, 0x14, 0xe9, 0xe3, 0x3e, 0x3f, 0x13, 0x6f,
    0x89, 0x72, 0x76, 0x41, 0x67, 0x8a, 0x48, 0x2a,
    0x36, 0xf0, 0xe6, 0xb9, 0x33, 0x35, 0x88, 0xda,
    0x27, 0x9d, 0xf9, 0x5d, 0x42, 0x04, 0x6f, 0x7d,
    0x60, 0x53, 0x86, 0xf2, 0xf4, 0x3b, 0x3d, 0xbe,
    0x1d, 0x99,
};

/* subject:/C=US/O=Apple Computer, Inc./OU=mac.com/CN=phased/description=.Mac Sharing Certificate */
/* issuer :/C=US/O=Apple Computer, Inc./OU=Apple Computer Certificate Authority/CN=Apple .Mac Certificate Authority */
static unsigned char _phased_c3[1376]={
0x30,0x82,0x05,0x5C,0x30,0x82,0x04,0x44,0xA0,0x03,0x02,0x01,0x02,0x02,0x03,0x20,
0x7D,0xC7,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,
0x00,0x30,0x81,0x86,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,
0x53,0x31,0x1D,0x30,0x1B,0x06,0x03,0x55,0x04,0x0A,0x13,0x14,0x41,0x70,0x70,0x6C,
0x65,0x20,0x43,0x6F,0x6D,0x70,0x75,0x74,0x65,0x72,0x2C,0x20,0x49,0x6E,0x63,0x2E,
0x31,0x2D,0x30,0x2B,0x06,0x03,0x55,0x04,0x0B,0x13,0x24,0x41,0x70,0x70,0x6C,0x65,
0x20,0x43,0x6F,0x6D,0x70,0x75,0x74,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,
0x69,0x63,0x61,0x74,0x65,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x31,
0x29,0x30,0x27,0x06,0x03,0x55,0x04,0x03,0x13,0x20,0x41,0x70,0x70,0x6C,0x65,0x20,
0x2E,0x4D,0x61,0x63,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,
0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x30,0x37,
0x31,0x30,0x32,0x38,0x31,0x38,0x35,0x34,0x35,0x33,0x5A,0x17,0x0D,0x30,0x38,0x31,
0x30,0x32,0x38,0x31,0x38,0x35,0x34,0x35,0x33,0x5A,0x30,0x72,0x31,0x0B,0x30,0x09,
0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x1D,0x30,0x1B,0x06,0x03,0x55,
0x04,0x0A,0x13,0x14,0x41,0x70,0x70,0x6C,0x65,0x20,0x43,0x6F,0x6D,0x70,0x75,0x74,
0x65,0x72,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,
0x0B,0x13,0x07,0x6D,0x61,0x63,0x2E,0x63,0x6F,0x6D,0x31,0x0F,0x30,0x0D,0x06,0x03,
0x55,0x04,0x03,0x13,0x06,0x70,0x68,0x61,0x73,0x65,0x64,0x31,0x21,0x30,0x1F,0x06,
0x03,0x55,0x04,0x0D,0x13,0x18,0x2E,0x4D,0x61,0x63,0x20,0x53,0x68,0x61,0x72,0x69,
0x6E,0x67,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x30,0x81,
0x9F,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,
0x03,0x81,0x8D,0x00,0x30,0x81,0x89,0x02,0x81,0x81,0x00,0xC0,0xFB,0x0E,0x62,0xD3,
0xE2,0xCC,0xC7,0x54,0x6A,0x4F,0x9C,0x4E,0x40,0x9D,0x30,0x3D,0x60,0x86,0x00,0x7C,
0x33,0x0C,0x2E,0x2E,0x45,0xDF,0xBE,0xEB,0x94,0xE7,0xD6,0xBE,0x6B,0x0F,0x7B,0x88,
0x3C,0x02,0xA7,0x25,0x5E,0x18,0xC6,0x97,0xF0,0x0C,0xDD,0x89,0x22,0x27,0x9C,0x85,
0x25,0x36,0x95,0x61,0x26,0xE7,0x6C,0x7E,0x41,0xDE,0xFF,0x5D,0x77,0xCB,0xE6,0x05,
0xB0,0xAD,0x77,0xC9,0xFC,0xA5,0xF1,0x82,0x1A,0xB4,0xE4,0x26,0x8D,0x1B,0xC3,0xE2,
0xEF,0x6A,0xE0,0xEE,0xF3,0x38,0x27,0xE1,0x73,0x9E,0xD0,0x93,0x6A,0xA6,0xD5,0xD1,
0xEC,0xE5,0x0D,0x4B,0x3A,0x42,0x8C,0xF1,0xE1,0x24,0x0A,0x02,0x0D,0x22,0xAE,0xEC,
0x47,0xDA,0xFA,0x6B,0x12,0x50,0x47,0x2E,0x4A,0xD8,0x9F,0x02,0x03,0x01,0x00,0x01,
0xA3,0x82,0x02,0x68,0x30,0x82,0x02,0x64,0x30,0x0C,0x06,0x03,0x55,0x1D,0x13,0x01,
0x01,0xFF,0x04,0x02,0x30,0x00,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,
0x04,0x04,0x03,0x02,0x03,0x88,0x30,0x28,0x06,0x03,0x55,0x1D,0x25,0x04,0x21,0x30,
0x1F,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x02,0x06,0x0A,0x2A,0x86,0x48,
0x86,0xF7,0x63,0x64,0x03,0x02,0x01,0x06,0x07,0x2B,0x06,0x01,0x05,0x02,0x03,0x04,
0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x3D,0xD9,0xDD,0x8F,0x5B,
0x5E,0xA3,0x3A,0x8C,0x89,0x7F,0x8A,0x85,0x26,0xA7,0x84,0x0E,0xF3,0x0D,0x82,0x30,
0x1F,0x06,0x03,0x55,0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x7A,0x7D,0x90,0xB1,
0x30,0x59,0x08,0x92,0x91,0xF9,0x53,0xB9,0x71,0x1D,0x35,0x33,0x67,0x34,0x8B,0xD5,
0x30,0x81,0xAD,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x01,0x04,0x81,0xA0,
0x30,0x81,0x9D,0x30,0x28,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x86,
0x1C,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x63,0x65,0x72,0x74,0x69,0x6E,0x66,0x6F,
0x2E,0x6D,0x61,0x63,0x2E,0x63,0x6F,0x6D,0x2F,0x6F,0x63,0x73,0x70,0x30,0x44,0x06,
0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x02,0x86,0x38,0x68,0x74,0x74,0x70,0x3A,
0x2F,0x2F,0x77,0x77,0x77,0x2E,0x61,0x70,0x70,0x6C,0x65,0x2E,0x63,0x6F,0x6D,0x2F,
0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x61,0x75,0x74,0x68,0x6F,
0x72,0x69,0x74,0x79,0x2F,0x63,0x61,0x73,0x69,0x67,0x6E,0x65,0x72,0x73,0x2E,0x68,
0x74,0x6D,0x6C,0x30,0x2B,0x06,0x03,0x55,0x1D,0x12,0x86,0x24,0x68,0x74,0x74,0x70,
0x3A,0x2F,0x2F,0x63,0x65,0x72,0x74,0x69,0x6E,0x66,0x6F,0x2E,0x6D,0x61,0x63,0x2E,
0x63,0x6F,0x6D,0x2F,0x64,0x6F,0x74,0x4D,0x61,0x63,0x43,0x41,0x2E,0x63,0x65,0x72,
0x30,0x82,0x01,0x28,0x06,0x03,0x55,0x1D,0x20,0x04,0x82,0x01,0x1F,0x30,0x82,0x01,
0x1B,0x30,0x82,0x01,0x17,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x63,0x64,0x05,0x02,
0x30,0x82,0x01,0x08,0x30,0x40,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x02,0x01,
0x16,0x34,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x61,0x70,0x70,
0x6C,0x65,0x2E,0x63,0x6F,0x6D,0x2F,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,
0x74,0x65,0x61,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x2F,0x74,0x65,0x72,0x6D,
0x73,0x2E,0x68,0x74,0x6D,0x6C,0x30,0x81,0xC3,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,
0x07,0x02,0x02,0x30,0x81,0xB6,0x1A,0x81,0xB3,0x52,0x65,0x6C,0x69,0x61,0x6E,0x63,
0x65,0x20,0x6F,0x6E,0x20,0x74,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,
0x69,0x63,0x61,0x74,0x65,0x20,0x62,0x79,0x20,0x61,0x6E,0x79,0x20,0x70,0x61,0x72,
0x74,0x79,0x20,0x61,0x73,0x73,0x75,0x6D,0x65,0x73,0x20,0x61,0x63,0x63,0x65,0x70,
0x74,0x61,0x6E,0x63,0x65,0x20,0x6F,0x66,0x20,0x74,0x68,0x65,0x20,0x74,0x68,0x65,
0x6E,0x20,0x61,0x70,0x70,0x6C,0x69,0x63,0x61,0x62,0x6C,0x65,0x20,0x73,0x74,0x61,
0x6E,0x64,0x61,0x72,0x64,0x20,0x74,0x65,0x72,0x6D,0x73,0x20,0x61,0x6E,0x64,0x20,
0x63,0x6F,0x6E,0x64,0x69,0x74,0x69,0x6F,0x6E,0x73,0x20,0x6F,0x66,0x20,0x75,0x73,
0x65,0x2C,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x70,
0x6F,0x6C,0x69,0x63,0x79,0x20,0x61,0x6E,0x64,0x20,0x63,0x65,0x72,0x74,0x69,0x66,
0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x70,0x72,0x61,0x63,0x74,0x69,0x63,0x65,
0x20,0x73,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x73,0x2E,0x30,0x0D,0x06,0x09,
0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,
0x30,0x48,0x04,0xA8,0x63,0x5A,0x7A,0xF9,0xEA,0x8B,0xF7,0x7F,0xF6,0x27,0x21,0x02,
0xE2,0x83,0xC8,0x64,0x99,0xB3,0x40,0x71,0x97,0x30,0xE2,0x92,0xD4,0x58,0xB8,0xD8,
0xF1,0xAA,0x30,0x59,0x75,0x4C,0x67,0x16,0xF8,0x38,0xBD,0xD7,0xF4,0xEA,0x03,0xB5,
0xE6,0x42,0xF8,0x95,0xBA,0x5B,0xE4,0x3C,0xA8,0x75,0x6C,0x05,0xFB,0x3C,0x3C,0xE3,
0x08,0x90,0x5F,0x6D,0x7E,0x3A,0xEA,0xBD,0x19,0x52,0x82,0x3B,0x9C,0x7F,0x64,0x15,
0x3A,0xCA,0x54,0x52,0x57,0xEB,0x53,0x09,0xE8,0x05,0x53,0x79,0xB9,0x7D,0x51,0xA3,
0x8E,0x31,0xF1,0xE5,0x5E,0xC6,0xA6,0x81,0x11,0x68,0x0A,0x17,0xD5,0xA0,0xBB,0x49,
0xF3,0x4E,0x59,0x1D,0xCB,0xCA,0x3E,0x09,0x64,0x2F,0x27,0x6C,0xCA,0x39,0x50,0x73,
0x42,0x5C,0x9D,0xE2,0x92,0x45,0x37,0x7F,0x02,0xF0,0x2B,0xA0,0xDD,0x1C,0x02,0xDC,
0x77,0xA9,0x0C,0xEA,0x14,0xAE,0xDE,0x81,0xDF,0x3E,0x31,0x59,0xF6,0xF7,0xE5,0x7F,
0xBC,0x7C,0xFD,0xE8,0x22,0xBE,0x9A,0x78,0xDD,0xFD,0x32,0x7F,0xE0,0xEC,0x0F,0x8D,
0x4D,0xB5,0xDE,0xF6,0x91,0x4B,0xAD,0xDB,0x7D,0xF9,0x07,0xB8,0x2B,0x0E,0xB5,0x58,
0x05,0xA2,0x85,0xF6,0x72,0x0E,0xCB,0x63,0x4E,0x8F,0xBF,0xD6,0x33,0x6F,0xF3,0xC2,
0x53,0xFA,0x67,0x5D,0x19,0xA8,0x49,0x1C,0x05,0x5D,0xAF,0x6C,0xDC,0x14,0x37,0xD5,
0x65,0x42,0x24,0x3B,0x69,0xC9,0x78,0x3F,0x4B,0x0E,0xAF,0x13,0x37,0x00,0x1E,0x6B,
0xCE,0xB9,0xCC,0xAA,0x99,0x1A,0xB7,0x5A,0x27,0xB9,0xE9,0xD6,0x87,0x0A,0xEB,0x77,
};

static unsigned char pem[] = "\n"
"-----BEGIN CERTIFICATE-----\n"
"MIIDSzCCAjOgAwIBAgIJAPsB+wAAAAABMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNV\n"
"BAYTAlVTMRMwEQYDVQQKEwpBcHBsZSBJbmMuMSYwJAYDVQQLEx1BcHBsZSBDZXJ0\n"
"aWZpY2F0aW9uIEF1dGhvcml0eTEyMDAGA1UEAxMpQXBwbGUgU2VjdXJlIEJvb3Qg\n"
"Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDcwMTA2MDUyMDUyWhcNMTcwMTA2\n"
"MDUyMDUyWjB0MQswCQYDVQQGEwJVUzETMBEGA1UEChMKQXBwbGUgSW5jLjEyMDAG\n"
"A1UECxMpQXBwbGUgU2VjdXJlIEJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkx\n"
"HDAaBgNVBAMTE1M1TDg5MDAgU2VjdXJlIEJvb3QwgZ8wDQYJKoZIhvcNAQEBBQAD\n"
"gY0AMIGJAoGBAMSrg/5uSm6EaOPbN2sedX5F31i+4x5BLd8cVbopszz/9OJZz/RD\n"
"tWbVkSh2O7PZbvfYwwHB6D3pebAA1S9rakwaKO7hKyKzHqpHeiqu+ECdmPGBRhFf\n"
"16zQL/pXzEnHn4IBfHcG5O49VqI8TK9pMZiqOQ4nh5H5mYIBImcaQ7frAgMBAAGj\n"
"WjBYMAsGA1UdDwQEAwIHgDAJBgNVHRMEAjAAMB0GA1UdDgQWBBQZ39dDpsNXFu2G\n"
"Qt2ylAihau3f3jAfBgNVHSMEGDAWgBRJPTZTydcV4YZhTqyrqxhWY13DxjANBgkq\n"
"hkiG9w0BAQUFAAOCAQEAlAHI8JncOxR8kSzIuN6jCY22DgiZYahvO7H3f68w3QO3\n"
"NE8Cp/UCECv+pQmlMuJPMAYzfLwGtoLhpq6BlCQXEc4KYhjGh5aicdXBkZDf+rA0\n"
"p1KphAd8c2UEIAWBbqU87q1FbDSJBw3YKN7C/I4qGnzUrWSpBbq6musM0QzO/uUZ\n"
"3R1QsfpicZ+nT/1WmlJSAwtoQsBjNAgMauhRLAJc/fCPi8TqONju/xxbGDYJ/cQs\n"
"bCGfszrUSeGYu4ryxeyNuu2L8gluHUKbhfZ7J1XYgIsvoCnk5E5hWJDhpIyywylb\n"
"9F/uRNib8zb0L80S64vAWC4m4QUJ3iLmTfIsk+NYPQ==\n"
"-----END CERTIFICATE-----\n";

static unsigned char _elektron_v1_cert_der[] = {
  0x30, 0x82, 0x02, 0x71, 0x30, 0x82, 0x01, 0xda, 0x02, 0x01, 0x01, 0x30,
  0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05,
  0x05, 0x00, 0x30, 0x81, 0x80, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
  0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,
  0x55, 0x04, 0x08, 0x13, 0x02, 0x63, 0x61, 0x31, 0x11, 0x30, 0x0f, 0x06,
  0x03, 0x55, 0x04, 0x07, 0x13, 0x08, 0x73, 0x61, 0x6e, 0x20, 0x6a, 0x6f,
  0x73, 0x65, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13,
  0x04, 0x62, 0x72, 0x61, 0x64, 0x31, 0x27, 0x30, 0x25, 0x06, 0x03, 0x55,
  0x04, 0x0b, 0x13, 0x1e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64,
  0x20, 0x62, 0x79, 0x20, 0x45, 0x6c, 0x65, 0x6b, 0x74, 0x72, 0x6f, 0x6e,
  0x20, 0x76, 0x32, 0x2e, 0x30, 0x2e, 0x31, 0x38, 0x35, 0x32, 0x31, 0x19,
  0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x10, 0x62, 0x72, 0x61,
  0x64, 0x20, 0x45, 0x6c, 0x65, 0x6b, 0x74, 0x72, 0x6f, 0x6e, 0x20, 0x43,
  0x41, 0x30, 0x1e, 0x17, 0x0d, 0x30, 0x33, 0x31, 0x32, 0x32, 0x33, 0x31,
  0x31, 0x34, 0x36, 0x30, 0x37, 0x5a, 0x17, 0x0d, 0x31, 0x33, 0x31, 0x32,
  0x32, 0x32, 0x31, 0x31, 0x34, 0x36, 0x30, 0x37, 0x5a, 0x30, 0x81, 0x80,
  0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55,
  0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x02,
  0x63, 0x61, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13,
  0x08, 0x73, 0x61, 0x6e, 0x20, 0x6a, 0x6f, 0x73, 0x65, 0x31, 0x0d, 0x30,
  0x0b, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x04, 0x62, 0x72, 0x61, 0x64,
  0x31, 0x27, 0x30, 0x25, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x1e, 0x50,
  0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x45,
  0x6c, 0x65, 0x6b, 0x74, 0x72, 0x6f, 0x6e, 0x20, 0x76, 0x32, 0x2e, 0x30,
  0x2e, 0x31, 0x38, 0x35, 0x32, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55,
  0x04, 0x03, 0x13, 0x10, 0x62, 0x72, 0x61, 0x64, 0x20, 0x45, 0x6c, 0x65,
  0x6b, 0x74, 0x72, 0x6f, 0x6e, 0x20, 0x43, 0x41, 0x30, 0x81, 0x9f, 0x30,
  0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01,
  0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81,
  0x00, 0xe0, 0xab, 0x3a, 0x05, 0x8d, 0xed, 0x81, 0x73, 0xa8, 0x76, 0x9c,
  0x14, 0x07, 0x50, 0x4b, 0x56, 0x8f, 0xfe, 0x88, 0xba, 0xec, 0xde, 0xab,
  0x9a, 0x5d, 0x49, 0x23, 0x3b, 0x87, 0x4f, 0x50, 0x59, 0x8d, 0x0f, 0x78,
  0xd0, 0x61, 0x98, 0x28, 0x9d, 0x1d, 0x39, 0xbf, 0x92, 0x62, 0xda, 0x21,
  0xf7, 0xb1, 0x32, 0x6a, 0x5d, 0x73, 0x1c, 0x1d, 0x36, 0xba, 0xf7, 0x3c,
  0xff, 0xda, 0xd9, 0xff, 0xf0, 0xbd, 0x62, 0x1d, 0xde, 0x6d, 0xc7, 0x76,
  0x93, 0xdd, 0x3a, 0x90, 0x2b, 0x97, 0xab, 0x86, 0xea, 0x48, 0xb5, 0x70,
  0xe7, 0xe1, 0xa2, 0x5c, 0x61, 0x1a, 0x7d, 0x48, 0x4d, 0x83, 0x42, 0x73,
  0x70, 0xaf, 0x5d, 0xcf, 0x8c, 0x26, 0xb4, 0x83, 0xff, 0x77, 0xd5, 0x64,
  0xe0, 0x14, 0x52, 0x20, 0xa2, 0xe9, 0xc5, 0x8c, 0x70, 0xb5, 0x6f, 0xf5,
  0x6d, 0x31, 0x2b, 0xcb, 0x1d, 0xad, 0xf4, 0xb2, 0x27, 0x02, 0x03, 0x01,
  0x00, 0x01, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
  0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x74, 0x49, 0x79,
  0x14, 0xc0, 0x68, 0xd7, 0x9d, 0xfd, 0x35, 0x6a, 0xda, 0xa0, 0x1d, 0x46,
  0x0a, 0xc6, 0x1b, 0x51, 0x4b, 0xdf, 0x27, 0xd6, 0x14, 0x1a, 0xcf, 0xf1,
  0xd0, 0xe2, 0x1b, 0x92, 0x39, 0x33, 0x98, 0x13, 0xc2, 0x6e, 0x97, 0xed,
  0x2b, 0x1b, 0xfc, 0x28, 0x8a, 0x93, 0xf9, 0xe5, 0xe1, 0xf0, 0xbf, 0xf8,
  0xa3, 0x5e, 0x08, 0x9c, 0x9f, 0x61, 0x7d, 0xb9, 0xe7, 0x14, 0x0e, 0x6d,
  0x07, 0x3e, 0x35, 0x12, 0xd4, 0x98, 0x2e, 0x0a, 0x9c, 0x5c, 0xb9, 0xbf,
  0x20, 0x29, 0x01, 0x55, 0x82, 0x86, 0xa7, 0xcb, 0x97, 0x8f, 0xbb, 0xd8,
  0x2b, 0xbd, 0x40, 0xd3, 0x1a, 0xa7, 0xb1, 0x66, 0x5c, 0xe5, 0x9a, 0x7b,
  0x39, 0xb7, 0x73, 0x49, 0x2c, 0x44, 0x8c, 0x79, 0x5b, 0xb5, 0x18, 0x41,
  0xd0, 0xf1, 0x4b, 0x6d, 0xc5, 0x1a, 0xf8, 0x51, 0xea, 0x99, 0x0d, 0x85,
  0x1b, 0xbe, 0x16, 0x56, 0x18
};

#if 0 // currently unused.
static unsigned int _elektron_v1_cert_der_len = 629;
#endif

static unsigned char _wapi_as_der[] = {
  0x30, 0x82, 0x01, 0xb7, 0x30, 0x82, 0x01, 0x6c, 0xa0, 0x03, 0x02, 0x01,
  0x02, 0x02, 0x01, 0x12, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x81, 0x1c, 0xd7,
  0x63, 0x01, 0x01, 0x01, 0x05, 0x00, 0x30, 0x1d, 0x31, 0x0c, 0x30, 0x0a,
  0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x03, 0x54, 0x4d, 0x43, 0x31, 0x0d,
  0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x04, 0x57, 0x41, 0x50,
  0x49, 0x30, 0x1e, 0x17, 0x0d, 0x37, 0x30, 0x30, 0x31, 0x30, 0x31, 0x30,
  0x30, 0x30, 0x30, 0x31, 0x38, 0x5a, 0x17, 0x0d, 0x39, 0x30, 0x30, 0x31,
  0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x31, 0x38, 0x5a, 0x30, 0x1d, 0x31,
  0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x03, 0x54, 0x4d,
  0x43, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x04,
  0x57, 0x41, 0x50, 0x49, 0x30, 0x4a, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86,
  0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x09, 0x2a, 0x81, 0x1c, 0xd7, 0x63,
  0x01, 0x01, 0x02, 0x01, 0x03, 0x32, 0x00, 0x04, 0x74, 0xd9, 0x78, 0x91,
  0xc4, 0xd3, 0xb5, 0x9e, 0xb0, 0xa9, 0x9e, 0xf1, 0x01, 0x5b, 0xd7, 0x7f,
  0x79, 0x9a, 0x02, 0xe5, 0x87, 0x65, 0xa1, 0x0d, 0x04, 0xc9, 0x06, 0xdb,
  0xf6, 0x12, 0x24, 0x05, 0x9d, 0x1c, 0x51, 0x00, 0x75, 0x58, 0x46, 0x11,
  0xe3, 0xdc, 0x71, 0x02, 0x69, 0x43, 0x37, 0x61, 0xa3, 0x81, 0xa9, 0x30,
  0x81, 0xa6, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04,
  0x14, 0x08, 0xa9, 0x47, 0x65, 0xf2, 0x39, 0xa9, 0xe8, 0x8b, 0xd1, 0x75,
  0x43, 0xce, 0x8c, 0x1c, 0xc0, 0xec, 0x99, 0xae, 0xad, 0x30, 0x45, 0x06,
  0x03, 0x55, 0x1d, 0x23, 0x04, 0x3e, 0x30, 0x3c, 0x80, 0x14, 0x08, 0xa9,
  0x47, 0x65, 0xf2, 0x39, 0xa9, 0xe8, 0x8b, 0xd1, 0x75, 0x43, 0xce, 0x8c,
  0x1c, 0xc0, 0xec, 0x99, 0xae, 0xad, 0xa1, 0x21, 0xa4, 0x1f, 0x30, 0x1d,
  0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x03, 0x54,
  0x4d, 0x43, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
  0x04, 0x57, 0x41, 0x50, 0x49, 0x82, 0x01, 0x12, 0x30, 0x31, 0x06, 0x03,
  0x55, 0x1d, 0x1f, 0x04, 0x2a, 0x30, 0x28, 0x30, 0x26, 0xa0, 0x24, 0xa0,
  0x22, 0x86, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x31, 0x39,
  0x32, 0x2e, 0x31, 0x36, 0x38, 0x2e, 0x31, 0x2e, 0x32, 0x30, 0x30, 0x3a,
  0x38, 0x30, 0x38, 0x30, 0x2f, 0x61, 0x73, 0x2e, 0x63, 0x72, 0x6c, 0x30,
  0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80,
  0x30, 0x0c, 0x06, 0x08, 0x2a, 0x81, 0x1c, 0xd7, 0x63, 0x01, 0x01, 0x01,
  0x05, 0x00, 0x03, 0x37, 0x00, 0x30, 0x34, 0x02, 0x18, 0x23, 0xc5, 0x39,
  0xc9, 0x91, 0x89, 0x3d, 0xe5, 0xae, 0x95, 0x75, 0x88, 0x68, 0xf6, 0x11,
  0x64, 0xb1, 0x71, 0xe7, 0x67, 0x1f, 0xa1, 0x58, 0x77, 0x02, 0x18, 0x15,
  0xef, 0x5a, 0x62, 0x7f, 0x7d, 0x9d, 0x6e, 0x6d, 0x91, 0x2b, 0x61, 0x15,
  0x4d, 0x5a, 0xbe, 0xc8, 0x8d, 0xdc, 0x85, 0x00, 0xa9, 0x7d, 0x99
};

#if 0 // currently unused.
static unsigned int _wapi_as_der_len = 443;
#endif

/* subject:/DC=com/DC=outsidevpntest/CN=Users/CN=certxauthsplit */
/* issuer :/DC=com/DC=outsidevpntest/CN=outsidevpntest-SERVER02-CA */
static uint8_t two_common_names[1427]={
    0x30,0x82,0x05,0x8F,0x30,0x82,0x04,0x77,0xA0,0x03,0x02,0x01,0x02,0x02,0x0A,0x45,
    0x0F,0xA6,0x09,0x00,0x00,0x00,0x00,0x00,0x16,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,
    0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x5A,0x31,0x13,0x30,0x11,0x06,0x0A,
    0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x19,0x16,0x03,0x63,0x6F,0x6D,0x31,
    0x1E,0x30,0x1C,0x06,0x0A,0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x19,0x16,
    0x0E,0x6F,0x75,0x74,0x73,0x69,0x64,0x65,0x76,0x70,0x6E,0x74,0x65,0x73,0x74,0x31,
    0x23,0x30,0x21,0x06,0x03,0x55,0x04,0x03,0x13,0x1A,0x6F,0x75,0x74,0x73,0x69,0x64,
    0x65,0x76,0x70,0x6E,0x74,0x65,0x73,0x74,0x2D,0x53,0x45,0x52,0x56,0x45,0x52,0x30,
    0x32,0x2D,0x43,0x41,0x30,0x1E,0x17,0x0D,0x31,0x32,0x30,0x39,0x30,0x36,0x30,0x33,
    0x30,0x32,0x30,0x30,0x5A,0x17,0x0D,0x31,0x33,0x30,0x39,0x30,0x36,0x30,0x33,0x30,
    0x32,0x30,0x30,0x5A,0x30,0x5E,0x31,0x13,0x30,0x11,0x06,0x0A,0x09,0x92,0x26,0x89,
    0x93,0xF2,0x2C,0x64,0x01,0x19,0x16,0x03,0x63,0x6F,0x6D,0x31,0x1E,0x30,0x1C,0x06,
    0x0A,0x09,0x92,0x26,0x89,0x93,0xF2,0x2C,0x64,0x01,0x19,0x16,0x0E,0x6F,0x75,0x74,
    0x73,0x69,0x64,0x65,0x76,0x70,0x6E,0x74,0x65,0x73,0x74,0x31,0x0E,0x30,0x0C,0x06,
    0x03,0x55,0x04,0x03,0x13,0x05,0x55,0x73,0x65,0x72,0x73,0x31,0x17,0x30,0x15,0x06,
    0x03,0x55,0x04,0x03,0x13,0x0E,0x63,0x65,0x72,0x74,0x78,0x61,0x75,0x74,0x68,0x73,
    0x70,0x6C,0x69,0x74,0x30,0x81,0x9F,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,
    0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8D,0x00,0x30,0x81,0x89,0x02,0x81,0x81,
    0x00,0xB9,0xC7,0x0A,0x4A,0x2D,0xA4,0xD4,0x8F,0x0A,0xC3,0x49,0xDC,0xA0,0xE2,0x36,
    0x67,0x2E,0x0E,0xD2,0x02,0xA8,0x3B,0x23,0xDF,0xE4,0x67,0xCA,0x98,0xB9,0x37,0x10,
    0xF9,0x7D,0x76,0x40,0x3F,0xED,0xBE,0x0E,0x8C,0x3B,0x1A,0x91,0x61,0x37,0x5B,0x8E,
    0xDA,0xB5,0x98,0xD0,0x4A,0x2E,0x1B,0xB4,0xF8,0xBC,0xAB,0x5B,0x90,0xE7,0x46,0x3C,
    0xDC,0x62,0x0F,0xD0,0x97,0x28,0x15,0x91,0x2F,0xD5,0x33,0x63,0xA5,0x4F,0xD2,0x84,
    0x0D,0x7C,0xD0,0x8A,0x5B,0x20,0x23,0xF3,0xAA,0x1E,0xAC,0xB4,0x31,0xE3,0xAF,0x6C,
    0x51,0xBE,0xC1,0xBE,0xCE,0x12,0x34,0x6E,0x6D,0x09,0xB3,0x9D,0x88,0x6D,0x35,0x37,
    0xCB,0xDB,0x08,0xF3,0x55,0x98,0x62,0x75,0x93,0x6B,0x15,0xD0,0xF1,0xFC,0x59,0xB4,
    0x37,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,0x02,0xD5,0x30,0x82,0x02,0xD1,0x30,0x0E,
    0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x05,0xA0,0x30,0x44,
    0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x0F,0x04,0x37,0x30,0x35,0x30,
    0x0E,0x06,0x08,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x02,0x02,0x02,0x00,0x80,0x30,
    0x0E,0x06,0x08,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x04,0x02,0x02,0x00,0x80,0x30,
    0x07,0x06,0x05,0x2B,0x0E,0x03,0x02,0x07,0x30,0x0A,0x06,0x08,0x2A,0x86,0x48,0x86,
    0xF7,0x0D,0x03,0x07,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0xDD,
    0x63,0xE5,0xA8,0xBE,0x94,0x8D,0x3B,0xCF,0xDB,0x51,0x4A,0xAB,0x63,0xDC,0x5A,0x30,
    0x12,0x66,0x16,0x30,0x17,0x06,0x09,0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x14,0x02,
    0x04,0x0A,0x1E,0x08,0x00,0x55,0x00,0x73,0x00,0x65,0x00,0x72,0x30,0x1F,0x06,0x03,
    0x55,0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x13,0x9B,0xAB,0x61,0x39,0x5F,0x45,
    0x84,0xDB,0x37,0x72,0xD7,0xAC,0x67,0x19,0x26,0xBD,0x85,0x33,0xC0,0x30,0x81,0xE0,
    0x06,0x03,0x55,0x1D,0x1F,0x04,0x81,0xD8,0x30,0x81,0xD5,0x30,0x81,0xD2,0xA0,0x81,
    0xCF,0xA0,0x81,0xCC,0x86,0x81,0xC9,0x6C,0x64,0x61,0x70,0x3A,0x2F,0x2F,0x2F,0x43,
    0x4E,0x3D,0x6F,0x75,0x74,0x73,0x69,0x64,0x65,0x76,0x70,0x6E,0x74,0x65,0x73,0x74,
    0x2D,0x53,0x45,0x52,0x56,0x45,0x52,0x30,0x32,0x2D,0x43,0x41,0x2C,0x43,0x4E,0x3D,
    0x73,0x65,0x72,0x76,0x65,0x72,0x30,0x32,0x2C,0x43,0x4E,0x3D,0x43,0x44,0x50,0x2C,
    0x43,0x4E,0x3D,0x50,0x75,0x62,0x6C,0x69,0x63,0x25,0x32,0x30,0x4B,0x65,0x79,0x25,
    0x32,0x30,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x2C,0x43,0x4E,0x3D,0x53,0x65,
    0x72,0x76,0x69,0x63,0x65,0x73,0x2C,0x43,0x4E,0x3D,0x43,0x6F,0x6E,0x66,0x69,0x67,
    0x75,0x72,0x61,0x74,0x69,0x6F,0x6E,0x2C,0x44,0x43,0x3D,0x6F,0x75,0x74,0x73,0x69,
    0x64,0x65,0x76,0x70,0x6E,0x74,0x65,0x73,0x74,0x2C,0x44,0x43,0x3D,0x63,0x6F,0x6D,
    0x3F,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x52,0x65,0x76,0x6F,
    0x63,0x61,0x74,0x69,0x6F,0x6E,0x4C,0x69,0x73,0x74,0x3F,0x62,0x61,0x73,0x65,0x3F,
    0x6F,0x62,0x6A,0x65,0x63,0x74,0x43,0x6C,0x61,0x73,0x73,0x3D,0x63,0x52,0x4C,0x44,
    0x69,0x73,0x74,0x72,0x69,0x62,0x75,0x74,0x69,0x6F,0x6E,0x50,0x6F,0x69,0x6E,0x74,
    0x30,0x81,0xD3,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x01,0x01,0x04,0x81,0xC6,
    0x30,0x81,0xC3,0x30,0x81,0xC0,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x30,0x02,
    0x86,0x81,0xB3,0x6C,0x64,0x61,0x70,0x3A,0x2F,0x2F,0x2F,0x43,0x4E,0x3D,0x6F,0x75,
    0x74,0x73,0x69,0x64,0x65,0x76,0x70,0x6E,0x74,0x65,0x73,0x74,0x2D,0x53,0x45,0x52,
    0x56,0x45,0x52,0x30,0x32,0x2D,0x43,0x41,0x2C,0x43,0x4E,0x3D,0x41,0x49,0x41,0x2C,
    0x43,0x4E,0x3D,0x50,0x75,0x62,0x6C,0x69,0x63,0x25,0x32,0x30,0x4B,0x65,0x79,0x25,
    0x32,0x30,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x2C,0x43,0x4E,0x3D,0x53,0x65,
    0x72,0x76,0x69,0x63,0x65,0x73,0x2C,0x43,0x4E,0x3D,0x43,0x6F,0x6E,0x66,0x69,0x67,
    0x75,0x72,0x61,0x74,0x69,0x6F,0x6E,0x2C,0x44,0x43,0x3D,0x6F,0x75,0x74,0x73,0x69,
    0x64,0x65,0x76,0x70,0x6E,0x74,0x65,0x73,0x74,0x2C,0x44,0x43,0x3D,0x63,0x6F,0x6D,
    0x3F,0x63,0x41,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x3F,0x62,
    0x61,0x73,0x65,0x3F,0x6F,0x62,0x6A,0x65,0x63,0x74,0x43,0x6C,0x61,0x73,0x73,0x3D,
    0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x41,0x75,0x74,
    0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x29,0x06,0x03,0x55,0x1D,0x25,0x04,0x22,0x30,
    0x20,0x06,0x0A,0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x0A,0x03,0x04,0x06,0x08,0x2B,
    0x06,0x01,0x05,0x05,0x07,0x03,0x04,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x03,
    0x02,0x30,0x3C,0x06,0x03,0x55,0x1D,0x11,0x04,0x35,0x30,0x33,0xA0,0x31,0x06,0x0A,
    0x2B,0x06,0x01,0x04,0x01,0x82,0x37,0x14,0x02,0x03,0xA0,0x23,0x0C,0x21,0x63,0x65,
    0x72,0x74,0x78,0x61,0x75,0x74,0x68,0x73,0x70,0x6C,0x69,0x74,0x40,0x6F,0x75,0x74,
    0x73,0x69,0x64,0x65,0x76,0x70,0x6E,0x74,0x65,0x73,0x74,0x2E,0x63,0x6F,0x6D,0x30,
    0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,
    0x01,0x01,0x00,0x98,0xD5,0x24,0x83,0x28,0xC0,0xB5,0xE2,0xF9,0x22,0xE6,0xED,0x9C,
    0xC8,0xFB,0x07,0xB0,0x23,0x16,0xD0,0x62,0x32,0xF4,0xCC,0x71,0x00,0x31,0x48,0x8A,
    0x5D,0xFA,0xDC,0x80,0x49,0x35,0x38,0x16,0x81,0xA8,0xA8,0x01,0x69,0xC1,0x64,0xD9,
    0x64,0x72,0xC4,0xB3,0x24,0x02,0x7C,0xB8,0xD9,0x92,0xAA,0x28,0xB0,0x87,0x63,0x73,
    0x21,0xD7,0x4D,0x68,0x2D,0x99,0xF5,0x9B,0x10,0xD1,0x6B,0xF3,0xF8,0x1B,0x7B,0x73,
    0x2E,0x06,0xF1,0x17,0xCA,0xEE,0xAA,0xD7,0x6B,0x14,0x72,0x2E,0xA5,0x3C,0xC3,0x4A,
    0xFA,0x1C,0x28,0x72,0x16,0x08,0x33,0xF7,0x94,0xA1,0x30,0x94,0x37,0xF0,0xB3,0xAF,
    0xA5,0x49,0xD1,0x87,0xEB,0xD7,0xA0,0x3F,0xA7,0xDA,0x4D,0x70,0xFD,0xA9,0x53,0x82,
    0x1B,0xA7,0x6A,0xC8,0x3A,0x9D,0x9C,0x09,0x4D,0xD5,0xB1,0x71,0xFC,0xC4,0xC6,0x9D,
    0x9F,0xC5,0x16,0x13,0x7F,0x53,0x7C,0x5E,0x83,0xB0,0x8F,0xFA,0x24,0x9F,0xD3,0x2A,
    0x64,0x7E,0xA2,0x98,0x30,0x5B,0x7F,0x41,0x6C,0xE3,0xD4,0xE8,0x1E,0x18,0x2A,0x83,
    0x05,0x0F,0x0C,0x6A,0xF6,0x03,0xEB,0xF9,0x77,0x67,0xB9,0x4C,0xF7,0x98,0x45,0xC6,
    0x52,0x7E,0xF0,0xFA,0xAD,0x96,0xCC,0xA3,0x19,0xA7,0xF5,0x06,0x35,0x28,0x5E,0xE4,
    0xAC,0x8E,0x06,0x32,0xCC,0xEB,0xA6,0x0C,0x39,0xD3,0xF8,0xCF,0xA5,0xEC,0x87,0x74,
    0x58,0xFA,0xBE,0xB7,0x89,0xA3,0x4A,0xD6,0x62,0x9D,0x3E,0x37,0x5E,0x1E,0xC1,0x9F,
    0xBC,0xE0,0xF7,0x86,0xE2,0x6D,0xFF,0x71,0x9B,0x93,0xA8,0xEE,0xD8,0xA0,0x8C,0x1B,
    0x99,0x58,0xFC,
};

/* Test basic add delete update copy matching stuff. */
static void tests(void)
{
	SecCertificateRef cert0, cert1, cert2, cert3, cert4, cert5, cert6;
	isnt(cert0 = SecCertificateCreateWithBytes(NULL, _c0, sizeof(_c0)),
		NULL, "create cert0");
	isnt(cert1 = SecCertificateCreateWithBytes(NULL, _c1, sizeof(_c1)),
		NULL, "create cert1");

    CFDataRef cert2Data = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault,
        _c2, sizeof(_c2), kCFAllocatorNull);
	isnt(cert2 = SecCertificateCreateWithData(kCFAllocatorDefault, cert2Data),
		NULL, "create cert2");
    CFReleaseNull(cert2Data);

	isnt(cert3 = SecCertificateCreateWithBytes(NULL, _phased_c3, sizeof(_phased_c3)),
		NULL, "create cert3");

    CFDataRef cert4data = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault,
        pem, sizeof(pem), kCFAllocatorNull);
    ok(cert4 = SecCertificateCreateWithPEM(NULL, cert4data), "create cert from pem");
    CFReleaseNull(cert4data);

	isnt(cert5 = SecCertificateCreateWithBytes(NULL, _elektron_v1_cert_der,
        sizeof(_elektron_v1_cert_der)), NULL, "create cert5");

	isnt(cert6 = SecCertificateCreateWithBytes(NULL, _wapi_as_der,
        sizeof(_wapi_as_der)), NULL, "create cert6");

    if (!cert0 || !cert1 || !cert2 || !cert3 || !cert4 || !cert5 || !cert6) {
        goto errOut;
    }

    ok(SecCertificateIsSelfSignedCA(cert0), "cert0 is CA");
    ok(!SecCertificateIsSelfSignedCA(cert1), "cert1 is not CA");
    ok(SecCertificateIsSelfSignedCA(cert5), "cert5 is v1 CA");

    CFStringRef subjectSummary, issuerSummary;
    isnt(subjectSummary = SecCertificateCopySubjectSummary(cert1), NULL,
        "cert1 has a subject summary");
    isnt(issuerSummary = SecCertificateCopyIssuerSummary(cert1), NULL,
        "cert1 has an issuer summary");

    ok(subjectSummary && CFEqual(subjectSummary, CFSTR("www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign, VeriSign International Server CA - Class 3, VeriSign, Inc.")),
        "subject summary is \"www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign, VeriSign International Server CA - Class 3, VeriSign, Inc.\"");
    ok(issuerSummary && CFEqual(issuerSummary,
        CFSTR("Class 3 Public Primary Certification Authority")),
        "issuer summary is \"Class 3 Public Primary Certification Authority\"");

    CFArrayRef ntPrincipalNames;
    ok(ntPrincipalNames = SecCertificateCopyNTPrincipalNames(cert2),
        "SecCertificateCopyNTPrincipalNames");
    is(CFArrayGetCount(ntPrincipalNames), 1, "we got 1 princialname back");
    CFStringRef principal = (CFStringRef)CFArrayGetValueAtIndex(ntPrincipalNames, 0);
    ok(CFEqual(principal, CFSTR("kmm6b@Virginia.EDU")),
        "first principal is kmm6b@Virginia.EDU");
    CFReleaseSafe(ntPrincipalNames);

	CFReleaseSafe(subjectSummary);
	CFReleaseSafe(issuerSummary);

    isnt(subjectSummary = SecCertificateCopySubjectSummary(cert3), NULL,
        "cert3 has a subject summary");
	/* @@@ this causes a double free without an extra retain in obtainSummaryFromX501Name():
	       summary->description = string = copyDERThingDescription(kCFAllocatorDefault, value, true); */
	CFReleaseSafe(subjectSummary);

    isnt(subjectSummary = SecCertificateCopySubjectSummary(cert4), NULL,
        "cert4 has a subject summary");
    ok(subjectSummary && CFEqual(subjectSummary, CFSTR("S5L8900 Secure Boot")),
        "cert4 is S5L8900 Secure Boot");
	CFReleaseSafe(subjectSummary);

    CFStringRef desc = NULL;
    ok(desc = CFCopyDescription(cert4), "cert4 CFCopyDescription works");
    CFReleaseNull(desc);

    CFDataRef spki1Hash = SecCertificateCopySubjectPublicKeyInfoSHA1Digest(cert0);
    isnt(spki1Hash, NULL, "cert0 has a SHA-1 subject public key info hash");
    CFReleaseSafe(spki1Hash);

    CFDataRef spki2Hash = SecCertificateCopySubjectPublicKeyInfoSHA256Digest(cert0);
    isnt(spki2Hash, NULL, "cert0 has a SHA-256 subject public key info hash");
    CFReleaseSafe(spki2Hash);

errOut:
	CFReleaseSafe(cert0);
	CFReleaseSafe(cert1);
	CFReleaseSafe(cert2);
	CFReleaseSafe(cert3);
	CFReleaseSafe(cert4);
	CFReleaseSafe(cert5);
	CFReleaseSafe(cert6);
}

static void test_common_name(void) {
    SecCertificateRef cert = NULL;
    CFStringRef commonName = NULL;

    require(cert = SecCertificateCreateWithBytes(NULL, two_common_names, sizeof(two_common_names)), errOut);
    require_noerr(SecCertificateCopyCommonName(cert, &commonName), errOut);
    is(CFStringCompare(commonName, CFSTR("certxauthsplit"), 0), kCFCompareEqualTo, "copy common name got the wrong name");

errOut:
    CFReleaseSafe(commonName);
    CFReleaseSafe(cert);
}

const uint8_t mail_google_com [] = {
    0x30, 0x82, 0x03, 0x22, 0x30, 0x82, 0x02, 0x8b, 0xa0, 0x03, 0x02, 0x01,
    0x02, 0x02, 0x10, 0x2b, 0x9f, 0x7e, 0xe5, 0xca, 0x25, 0xa6, 0x25, 0x14,
    0x20, 0x47, 0x82, 0x75, 0x3a, 0x9b, 0xb9, 0x30, 0x0d, 0x06, 0x09, 0x2a,
    0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x4c,
    0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x5a,
    0x41, 0x31, 0x25, 0x30, 0x23, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x1c,
    0x54, 0x68, 0x61, 0x77, 0x74, 0x65, 0x20, 0x43, 0x6f, 0x6e, 0x73, 0x75,
    0x6c, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x28, 0x50, 0x74, 0x79, 0x29, 0x20,
    0x4c, 0x74, 0x64, 0x2e, 0x31, 0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04,
    0x03, 0x13, 0x0d, 0x54, 0x68, 0x61, 0x77, 0x74, 0x65, 0x20, 0x53, 0x47,
    0x43, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x31, 0x31, 0x30,
    0x32, 0x36, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x31,
    0x33, 0x30, 0x39, 0x33, 0x30, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a,
    0x30, 0x69, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
    0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
    0x13, 0x0a, 0x43, 0x61, 0x6c, 0x69, 0x66, 0x6f, 0x72, 0x6e, 0x69, 0x61,
    0x31, 0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x07, 0x14, 0x0d, 0x4d,
    0x6f, 0x75, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x56, 0x69, 0x65, 0x77,
    0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x14, 0x0a, 0x47,
    0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x31, 0x18, 0x30,
    0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x14, 0x0f, 0x6d, 0x61, 0x69, 0x6c,
    0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x30,
    0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
    0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, 0x81, 0x89,
    0x02, 0x81, 0x81, 0x00, 0xaf, 0x39, 0x15, 0x98, 0x68, 0xe4, 0x92, 0xfe,
    0x4f, 0x4f, 0xf1, 0xbb, 0xff, 0x0d, 0x2e, 0xb0, 0xfe, 0x25, 0xaa, 0xbd,
    0x68, 0x04, 0x67, 0x27, 0xea, 0x6c, 0x43, 0x4c, 0xa7, 0x6d, 0xcb, 0xc8,
    0x8f, 0x7e, 0x81, 0xee, 0x87, 0x26, 0x25, 0x10, 0x12, 0x54, 0x33, 0x9e,
    0xaa, 0x3d, 0x9b, 0x8f, 0x8e, 0x92, 0xb3, 0x4b, 0x01, 0xe3, 0xf9, 0x4a,
    0x29, 0xc3, 0x0f, 0xfd, 0xac, 0xb7, 0xd3, 0x4c, 0x97, 0x29, 0x3f, 0x69,
    0x55, 0xcf, 0x70, 0x83, 0x04, 0xaf, 0x2e, 0x04, 0x6e, 0x74, 0xd6, 0x0f,
    0x17, 0x09, 0xfe, 0x9e, 0x20, 0x24, 0x24, 0xe3, 0xc7, 0x68, 0x9c, 0xac,
    0x11, 0xbd, 0x92, 0xe4, 0xb2, 0x1b, 0x09, 0xf2, 0x02, 0x32, 0xbb, 0x55,
    0x1b, 0x2d, 0x16, 0x5f, 0x30, 0x12, 0x23, 0xe2, 0x4c, 0x4a, 0x8d, 0xc2,
    0xda, 0x3f, 0xe1, 0xb8, 0xbf, 0xf7, 0x3a, 0xb1, 0x86, 0xbe, 0xf0, 0xc5,
    0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81, 0xe7, 0x30, 0x81, 0xe4, 0x30,
    0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30,
    0x00, 0x30, 0x36, 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04, 0x2f, 0x30, 0x2d,
    0x30, 0x2b, 0xa0, 0x29, 0xa0, 0x27, 0x86, 0x25, 0x68, 0x74, 0x74, 0x70,
    0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x74, 0x68, 0x61, 0x77, 0x74,
    0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x54, 0x68, 0x61, 0x77, 0x74, 0x65,
    0x53, 0x47, 0x43, 0x43, 0x41, 0x2e, 0x63, 0x72, 0x6c, 0x30, 0x28, 0x06,
    0x03, 0x55, 0x1d, 0x25, 0x04, 0x21, 0x30, 0x1f, 0x06, 0x08, 0x2b, 0x06,
    0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05,
    0x05, 0x07, 0x03, 0x02, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8,
    0x42, 0x04, 0x01, 0x30, 0x72, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05,
    0x07, 0x01, 0x01, 0x04, 0x66, 0x30, 0x64, 0x30, 0x22, 0x06, 0x08, 0x2b,
    0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x86, 0x16, 0x68, 0x74, 0x74,
    0x70, 0x3a, 0x2f, 0x2f, 0x6f, 0x63, 0x73, 0x70, 0x2e, 0x74, 0x68, 0x61,
    0x77, 0x74, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x3e, 0x06, 0x08, 0x2b,
    0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x32, 0x68, 0x74, 0x74,
    0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x74, 0x68, 0x61, 0x77,
    0x74, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73,
    0x69, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x54, 0x68, 0x61, 0x77, 0x74, 0x65,
    0x5f, 0x53, 0x47, 0x43, 0x5f, 0x43, 0x41, 0x2e, 0x63, 0x72, 0x74, 0x30,
    0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05,
    0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x35, 0x80, 0x11, 0xcd, 0x52, 0x3e,
    0x84, 0x29, 0xfb, 0xc1, 0x28, 0xe1, 0x20, 0xe5, 0x02, 0x8f, 0x5f, 0x71,
    0x65, 0x58, 0x1d, 0x62, 0x72, 0x57, 0x3c, 0xe6, 0x5e, 0x25, 0x61, 0xd3,
    0xcb, 0xad, 0x22, 0xf8, 0xd8, 0x81, 0xa4, 0xe7, 0xf4, 0xae, 0x7c, 0xd9,
    0xc1, 0x6d, 0xaa, 0x93, 0x0d, 0x62, 0x07, 0x9f, 0xf2, 0x67, 0x47, 0x99,
    0x34, 0x33, 0x4f, 0x3d, 0x02, 0x74, 0xf4, 0x81, 0xd6, 0x38, 0x08, 0x21,
    0xe8, 0xe2, 0xa1, 0xfa, 0x05, 0x41, 0x9c, 0x9c, 0xc9, 0xf9, 0xf3, 0xc8,
    0xa3, 0xee, 0x0d, 0xa5, 0xd7, 0x50, 0x54, 0x5e, 0x2f, 0x7d, 0x79, 0xb7,
    0x7e, 0x0a, 0x7c, 0xb6, 0xe2, 0x2c, 0xa8, 0xae, 0xfe, 0x94, 0xd7, 0xcd,
    0x16, 0x30, 0x71, 0x04, 0xaa, 0x9e, 0x79, 0xc3, 0xd2, 0xb6, 0x24, 0xa7,
    0x25, 0xab, 0xf0, 0x48, 0x8e, 0x2f, 0xc3, 0xa7, 0xbb, 0x50, 0xdd, 0x0f,
    0xcf, 0xb0,  };

static void test_copy_email_addresses(void) {
    SecCertificateRef cert = SecCertificateCreateWithBytes(NULL, mail_google_com, sizeof (mail_google_com));
    CFArrayRef array = NULL;
    CFStringRef name = NULL;

    ok_status(SecCertificateCopyCommonName(cert, &name), "Failed to get common name from cert");
    ok(name, "Failed to get common name");
    ok(CFEqual(name, CFSTR("mail.google.com")), "Got wrong common name");

    ok_status(SecCertificateCopyEmailAddresses (cert, &array), "Failed to get email addresses from cert");
    ok(array, "Failed to get email address array");
    is(CFArrayGetCount(array), 0, "Found unexpected email addresses");

    CFReleaseNull(cert);
    CFReleaseNull(name);
    CFReleaseNull(array);
}

int si_15_certificate(int argc, char *const *argv)
{
	plan_tests(30);

	tests();
    test_common_name();
    test_copy_email_addresses();

	return 0;
}
